﻿using System.Windows;
using System.Windows.Controls;

using Microsoft.Live.Messenger;

namespace MessengerSample
{
    public partial class ConversationWindow : UserControl
    {
        private Conversation conversation;

        public ConversationWindow()
        {
            InitializeComponent();
        }

        public void Initialize(Conversation conversation)
        {
            this.conversation = conversation;

            this.DataContext = this.conversation;
        }

        public Conversation Conversation
        {
            get { return this.conversation; }
        }

        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            // Send chat messsage
            this.conversation.SendMessage(new TextMessage(MessageTextBox.Text));

            // Clear out message text box
            MessageTextBox.Text = "";
        }
    }
}
